package com.example.wechat.util;

import java.util.*;
import java.util.regex.Pattern;

public class StringUtil {

    public static final String REGEX_MOBILE = "^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$";

    public static boolean isEmpty(List value) {
        if (null == value || value.size() == 0) {
            return true;
        }
        return false;
    }

    public static boolean isMobile(String mobile) {
        return Pattern.matches(REGEX_MOBILE, mobile);
    }

    public static String getStringObj(Object obj) {
        return null == obj | "".equals(obj) ? "" : obj.toString();
    }

    public static boolean isBlank(Object str) {
        if (str == null) {
            return true;
        }
        String s = str.toString().trim();
        return "".equals(s);
    }

    public static String trim(String str) {
        if (!isBlank(str)) {
            return str.trim();
        } else {
            return "";
        }
    }

    public static String getUUID() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }


}
